{extends file="profile/layout.tpl"}
{block name="title"}##NA_EDUCATION##{/block}
{block name="script"}
  $(document).ready(function () {
	 $('#fromDate').datepicker({
     showOn: "focus",
       yearRange: "-80:+0",
	   changeMonth: true,
	   changeYear: true,
	   dateFormat: "mm-yy"
    });
	$('#toDate').datepicker({
     showOn: "focus",
       yearRange: "-80:+0",
	   changeMonth: true,
	   changeYear: true,
	   dateFormat: "mm-yy"
    });
	 $('table#educations td a.delete').click(function()
    {
        if (confirm("Are you sure you want to delete this row?"))
        {
            var id = $(this).parent().parent().attr('id');
            var data = 'id=' + id ;
            var url = '2.php?'+data+'&action=delete';
			window.location.href = url;
        }
    });
	
	$("#frm2").validate({
            rules: {
                institution_vi: {
                    required: true
                },
                fromDate: {
                    required: true
                },
                
				major_vi: {
					required: true
				},
				degree_vi: {
					required: true
				}
            },
            messages: {

                institution_vi: {
                    required: '##EM_INSTITUTION_IS_REQUIRED##'
                },
                fromDate: {
                    required: '##EM_FROMDATE_IS_REQUIRED##'
                },
                
				major_vi: {
					required: '##EM_MAJOR_IS_REQUIRED##'
				},
				degree_vi: {
					required: '##EM_DEGREE_IS_REQUIRED##'
				}

            }
			});
  });
{/block}
{block name="name"}
    ##NG_EDUCATION##
{/block}
{block name="content"}
   

    
    <div class="clear">
        </div>	
 
	<div class="message error" style="display:{$is_display_error|default:'none'};">{$error_message|default:''}</div>
	
    <div class="box round first center">
        <h2>##NG_EDUCATION##</h2>
        <table class="data display datatable" name="educations" id="educations">
            <thead>
                <tr>
                    <td bgcolor="#FFFFFF"><div align="center"><strong>
                         #
                    </strong></div></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_TIME##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_INSTITUTION##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_MAJOR##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_DEGREE##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_UPLOAD_DEGREE##(*)
                    </strong></td>
                    <td bgcolor="#FFFFFF" align="center"></td>
                    <td bgcolor="#FFFFFF" align="center"></td>
                </tr>
            </thead>
            
            <tbody>
            {foreach $educations|default:array() as $i}
                        
                {if $i@index is div by 2}
                    <tr class="even" id="{$i.Ma}">
                {else}
                    <tr class="odd" id="{$i.Ma}">
                {/if}
                    <td><div align="center">
                            {$i@index + 1}
                    </div></td>
                    <td>
                        {$i.TuNgay|date_format:"%m-%Y"} - {$i.DenNgay|date_format:"%m-%Y"}
                    </td>
                    <td>
            <b>Vi :</b> {$i.TenCoSoDaoTao_vi} <br> <b>En:</b>{$i.TenCoSoDaoTao_en}
                    </td>
                    <td>
                          <b>Vi :</b>{$i.ChuyenNganh_vi}  <br> <b>En: </b>{$i.ChuyenNganh_en}
                    </td>
                    <td>
                        <b>Vi :</b>{$i.degree_vi} <br> <b>En:  {$i.degree_en}
                    </td>
                    <td><a href="download.php?url={$i.ChungChi_BangCap}">{$i.ChungChi_BangCap}</a>
                    </strong></td>
                    <td align="center"><a href="2.php?id={$i.Ma}&action=edit">##NG_EDIT##</a></td>
                    <td align="center"><a class="delete">##NG_DELETE##</a></td>
                </tr>            
                    
               
            {/foreach}
            </tbody> 
        </table>
    </div>

    <div class="box round first center">
        <h2>##NG_ADDITION_EDUCATION_INFO##</h2>
    <form id="frm2" name="frm2" action="2.php" method="post" enctype="multipart/form-data">
 
    <table class="data display datatable" cellpadding="10" cellspacing="10" 
        align="left" border="2">
        <tbody>
            <tr>
                <td style="vertical-align:middle">
				<input type="hidden" name="id" id="id" value="{$id|default:''}"/>
				<strong>##NG_INSTITUTION##:</strong></td>
                <td>
                    <table>
                        <tr>
                            <td>
                                ##NG_VIETNAMESE##
                            </td>
                            <td>
                                <input id="institution_vi" type="text" value="{$institution_vi|default:''}" maxlength="100" size="50" name="institution_vi" />(*)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                ##NG_ENGLISH##
                            </td>
                            <td>
                                <input id="institution_en" type="text" value="{$institution_en|default:''}" maxlength="100" size="50" name="institution_en"/>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>


            <tr>
                <td style="vertical-align:middle"><strong>##NG_ADDRESS##:</strong></td>
                <td>
                    <input id="address" type="text"  value="{$address|default:''}" maxlength="100" size="50" name="address"/>
                </td>
            </tr>


            <tr>
                <td  style="vertical-align:middle"><strong>##NG_TIME##:</strong></td>
                <td>
                    <table>
                    <tr>
                        <td>
                            ##NG_FROMDATE##:
                        </td>
                        <td>
                            <input type="text" id="fromDate" name="fromDate" value="{$fromDate|default:''|date_format:"%m-%Y"}"/>(mm-yyyy) (*)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            ##NG_TODATE##:
                        </td>
                        <td>
                        <input type="text" id="toDate" name="toDate" value="{$toDate|default:''|date_format:"%m-%Y"}"/>(mm-yyyy)
                        </td>
                    </tr>
                    </table>
                </td>
            </tr>

            <tr>
                <td style="vertical-align:middle"><strong>##NG_MAJOR##:</strong></td>
                <td>
                    <table>
                        <tr>
                            <td>
                                ##NG_VIETNAMESE##:
                            </td>
                            <td>
                                <input id="major_vi" type="text" value="{$major_vi|default:''}" maxlength="45" size="50" name="major_vi"/>(*)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                ##NG_ENGLISH##:
                            </td>
                            <td>
                                <input id="major_en" type="text" value="{$major_en|default:''}" maxlength="45" size="50" name="major_en"/>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>

            <tr>
                <td style="vertical-align:middle"><strong>##NG_DEGREE##:</strong></td>
                <td>
                    <table>
                        <tr>
                            <td>
                                ##NG_VIETNAMESE##:
                            </td>
                            <td>
                                <input id="degree_vi" type="text"  value="{$degree_vi|default:''}" maxlength="45" size="50" name="degree_vi"/>(*)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                ##NG_ENGLISH##:
                            </td>
                            <td>
                                <input id="degree_en" type="text" value="{$degree_en|default:''}" maxlength="45" size="50" name="degree_en"/>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>

            <tr>
                <td style="vertical-align:middle"><strong>##NG_UPLOAD_DEGREE##:</strong></td>
                <td>
                    {if isset($degree_uploaded)}
					
					<a href="download.php?url={$degree_uploaded}">{$degree_uploaded}</a><br>
					{/if}
					<input id="degree_upload" type="file" maxlength="255" size="50" name="degree_upload"/>
                </td>
            </tr>

            <tr>
                <td colspan="2">
                    <div style="float:left; height:auto">
                        <input type="submit" value="##NG_SAVE##" name="save" class="btn btn-blue"/>
                    </div>
                    <div style="float:right; height:auto">
                        <input type="button" value="##NG_NEXT##" name="next" onclick="window.location.href='3.php'" class="btn btn-blue" />
                    </div>
                </td>
            </tr>

        </tbody>
    </table>
    </form>
    </div>
    <div class="clear">
        </div>
{/block}